package com.wwwarehouse.usercenter.fragment.chain_triangles;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.wwwarehouse.common.tools.PopUpUtils;
import com.wwwarehouse.usercenter.R;
import com.wwwarehouse.usercenter.fragment.invite.ShowInvitedFragment;

import java.util.HashSet;
import java.util.Set;


public class TCShowInvitedFragment extends ShowInvitedFragment {
    protected String mSort;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        mBundle = getArguments();
        super.onCreate(savedInstanceState);
    }

    @Override
    public void sortClick(View anchor) {
        if (peekFragment() instanceof TCShowInvitedFragment) {
            PopUpUtils.showBubbleInviteSort(mActivity, anchor, mSelectedBubblePosition, new PopUpUtils.OnChoiceListener() {
                @Override
                public void onChoice(int position) {
                    mSelectedBubblePosition = position;
                    switch (position) {
                        case 1:
                            mSort = "INVALID_TIME";        //邀请时间正序
                            break;
                        case 2:
                            mSort = "INVALID_TIME DESC ";  //邀请时间倒序
                            break;
                        default:
                            break;
                    }

                    getInviteInfo(mMobile, mName, mStatusSet, mSort);
                }
            },"",getResources().getString(R.string.approval_time_asc),getResources().getString(R.string.approval_time_desc));
        }
    }

    @Override
    public void newFragment(int i) {
        super.newFragment(i);
        mBundle.putString("buId", getArguments().getString("buId"));
        mBundle.putString("manageType", getArguments().getString("manageType"));
        mBundle.putInt("from", getArguments().getInt("from",0));
    }

    @Override
    protected void newFragment() {
        mInviteDetailsFragment = new TCInviteDetailsFragment();
    }

    @Override
    protected Set<Integer> generateStatusSet() {
        Set<Integer> statusSet = new HashSet<>();
        statusSet.add(10);

        return statusSet;
    }

    @Override
    public void setTitle() {
        if (peekFragment() instanceof TCShowInvitedFragment) {
            mActivity.setTitle(getResources().getString(R.string.set_triangular_management));
        }
    }
}
